'''
@Author: your name
@Date: 2020-05-27 10:56:36
@LastEditTime: 2020-06-03 16:24:20
@LastEditors: your name
@Description: In User Settings Edit
@FilePath: /pyhanlp/tests/book/ch02/demo_acdat_segment.py
'''
# -*- coding:utf-8 -*-
# Author：hankcs
# Date: 2018-05-29 13:51
# 《自然语言处理入门》2.8 HanLP 的词典分词实现
# 配套书籍：http://nlp.hankcs.com/book.php
# 讨论答疑：https://bbs.hankcs.com/

from pyhanlp import *
from pyhanlp.static import HANLP_DATA_PATH
dict1 = HANLP_DATA_PATH + "/dictionary/CoreNatureDictionary.txt"
HanLP.Config.ShowTermNature = False
segment = DoubleArrayTrieSegment([dict1])
# JClass('com.hankcs.hanlp.seg.Other.AhoCorasickDoubleArrayTrieSegment')()
print(segment.seg("江西鄱阳湖干枯，中国最大淡水湖变成大草原"))

segment = JClass('com.hankcs.hanlp.seg.Other.AhoCorasickDoubleArrayTrieSegment')([dict1])
print(segment.seg("江西鄱阳湖干枯，中国最大淡水湖变成大草原"))